#include <stdio.h>
#include<string.h>
#include <sys/types.h>
#include <unistd.h>

#define FILENAME "log.txt"

int main()
{
    FILE *fp = fopen(FILENAME,"r");
    if(fp == NULL)
    {
        perror("fopen");
        return 1;
    }
    
    char buffer[64];
    while(1)
    {
       char *r = fgets(buffer,sizeof(buffer),fp);
       if(!r) break;

       printf("%s",buffer);
    }
  // const char *msg = "Hello AmAo!!!\n";
  // int cnt = 5;
  // while(cnt)
  // {
  //     int n = fwrite(msg,strlen(msg),1,fp);
  //     printf("write %d block,pid is : %d\n",n,getpid());
  //     cnt--;
  // }
    
    fclose(fp);
    return 0;
}

